import http from '@/plugins/axios'

export function getCustomerConsultationRecord(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/page',
    data
  })
}

export function addCustomerConsultationRecord(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/save',
    data
  })
}

export function updateCustomerConsultationRecord(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/update',
    data
  })
}

export function addCustomerShop(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerShop/addShop',
    data
  })
}

export function getCustomerShopDetail(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerShop/info',
    data
  })
}

export function updateCustomerShop(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerShop/update',
    data
  })
}

export function stopCooperation(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerShop/stopCooperation',
    data
  })
}

export function customerShopNotice(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerShop/notice',
    data
  })
}

export function getRecordPage(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerShop/recordPage',
    data
  })
}

export function removeCustomerConsultationRecord(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/delete',
    data
  })
}

/**
 * 获取商品组信息
 */
export function getCustomerManagementGroupShopInfo(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/groupShopInfo',
    data
  })
}

/**
 * 获取商品组列表
 */
export function getCustomerManagementGroupList(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/groupList',
    data
  })
}

/**
 * 分配商品
 */
export function getCustomerManagementDispatchGroup(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/dispatchGroup',
    data
  })
}

// 获取上次客户输入联系方式记录
export function getLastShopInfo(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerShop/getLastShopInfo',
    data
  })
}

export function getAllCustomType() {
  return http({
    method: 'POST',
    url: '/ykf/dictDetail/listByNo',
    data: { dictNo: 'customType' }
  })
}

/**
 * 批量修改店铺对接人
 */
export function batchUpdateStoreLiaison(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/batchUpdateStoreLiaison',
    data
  })
}

// 客户等级详情
export function getCustomerLvlInfo(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/customerLvlInfo',
    data
  })
}

export function getDictByNo(dictNo) {
  return http({
    method: 'POST',
    url: '/ykf/dictDetail/listByNo',
    data: { dictNo: dictNo }
  }).then(res => {
    return (res || []).map(item => ({ value: item.val, label: item.name }))
  })
}

export function updateGroupShopInfo(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerShop/updateGroupShopInfo',
    data
  })
}

export function getSubByShopId(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerSubAccount/page4',
    data
  })
}
